package aorise.com.frame;

import android.app.Activity;
import android.content.SharedPreferences;
import android.support.annotation.DrawableRes;
import android.view.WindowManager;
import android.widget.ImageView;

import aorise.com.frame.base.BBBaseActivity;
import aorise.com.frame.common.HandlerUtil;
import aorise.com.frame.ui.login.LoginActivity;

public class SplashActivity extends BBBaseActivity {

    private static final String TAG = SplashActivity.class.getSimpleName();
    private static final int DELAY_MILLIS = 1500;
    ImageView ivSplash;
    public static Activity splashactivity;

    private SharedPreferences sp;

    @Override
    protected void initView() {
        setContentView(R.layout.activity_splash);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        ivSplash = (ImageView) findViewById(R.id.iv_splash);
        ivSplash.setBackgroundResource(getBackgroundResource());
        fullScreen(this);
        HandlerUtil.runOnUiThreadDelay(new Runnable() {
            @Override
            public void run() {
                openActivity(LoginActivity.class);
                finish();
            }
        }, DELAY_MILLIS);

        splashactivity = this;
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void initEvent() {

    }

    /**
     * 设置背景图片
     *
     * @return
     */
    protected
    @DrawableRes
    int getBackgroundResource() {
        return R.drawable.yindaoye;
    }
}
